//
//  M3Subject.h
// 
//
//  Created by xm on 2023/8/31.
//

#import <Foundation/Foundation.h>
#import "M3Subscription.h"

NS_ASSUME_NONNULL_BEGIN


@interface M3Subject : NSObject


@property(nonatomic, strong) NSMutableArray<M3Subscription*> *subscriptions;
@property(nonatomic, strong) NSMutableArray<M3Subscription*> *disposableSubscriptions;


-(instancetype) init;
-(M3Subscription*) subscribeCode:(NSInteger) code caller:(id) caller block:(M3SubscriptionBlock) block;
-(M3Subscription*) subscribeOnceCode:(NSInteger) code caller:(id) caller block:(M3SubscriptionBlock) block;

-(void)notify:(NSInteger)code paylod:(nullable id)payload;

@end

NS_ASSUME_NONNULL_END
